#pragma once
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ptree_fwd.hpp>

extern boost::property_tree::ptree config;
#define MAX_LENGTH 1024 * 2
// 头部总长度
#define HEAD_TOTAL_LEN 4
// 头部id长度
#define HEAD_ID_LEN 2
// 头部数据长度
#define HEAD_DATA_LEN 2
#define MAX_REVEQUE 10000
#define MAX_SENDQUE 1000

enum ErrorCodes {
  Success = 0,
  JsonError = 1001,
  RPCFailed = 1002,
  VerifyExpired = 1003,
  VerifyCodeError = 1004,
  UserExist = 1005,
  EmailError = 1006,
  DataBaseError = 1007,
  PasswdInvalid = 1008,
  UuidInvalid = 1009,
  TokenInvalid = 1010,
  NameInvalid = 1011,
};

enum MSGID {
  MSG_CHAT_LOGIN = 1005,            // 用户登录
  MSG_CHAT_LOGIN_RSP = 1006,        // 用户登录回包
  ID_SEARCH_USER_REQ = 1007,        // 用户搜索请求
  ID_SEARCH_USER_RSP = 1008,        // 用户搜索回包
  ID_ADD_FRIEND_REQ = 1009,         // 添加好友申请
  ID_ADD_FRIEND_RSP = 1010,         // 添加好友回包
  ID_NOTIFY_ADD_FRIEND_REQ = 1011,  // 通知用户添加好友申请
  ID_AUTH_FRIEND_REQ = 1012,        // 认证好友请求
  ID_AUTH_FRIEND_RSP = 1013,        // 认证好友回复
  ID_NOTIFY_AUTH_FRIEND_REQ = 1014, // 通知用户认证好友申请
  ID_TEXT_CHAT_MSG_REQ = 1015,      // 文本聊天消息请求
  ID_TEXT_CHAT_MSG_RSP = 1016,      // 收到文本聊天消息回复

};

#define USER_IP_PREFIX "uid_"
#define USER_TOKEN_PREFIX "utoken_"
#define IP_COUNT_PREFIX "ipcount_"
#define USER_BASE_INFO "ubaseinfo_"
#define LOGIN_COUNT "logincount"
#define NAME_INFO "name_"